package com.web;

import com.pojo.PingJia_db;
import com.service.PingJiaService_db;
import com.util.ResultEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pingjia")
public class PingJiaController_db {
    @Autowired
    private PingJiaService_db pingJiaServiceDb;

    @RequestMapping("/show")
    public ResultEntity list(String stime,String etime,Integer id){
        return ResultEntity.ok(pingJiaServiceDb.list(stime, etime, id));
    }

    @RequestMapping("/all")
    public ResultEntity listAll(){
        return ResultEntity.ok(pingJiaServiceDb.listAll());
    }

    @RequestMapping("listid")

    public ResultEntity listById(Integer id){
        return ResultEntity.ok(pingJiaServiceDb.listById(id));
    }

    @RequestMapping("/add")
    public ResultEntity add(PingJia_db pingJiaDb){
        return ResultEntity.ok(pingJiaServiceDb.add(pingJiaDb));
    }

    @RequestMapping("/update")
    public ResultEntity update(PingJia_db pingJiaDb){
        return ResultEntity.ok(pingJiaServiceDb.update(pingJiaDb));
    }

    @RequestMapping("/delete")
    public ResultEntity del(Integer pId){
        return ResultEntity.ok(pingJiaServiceDb.del(pId));
    }
}
